package com.example.shushiyunsst.fragment.main.home.child.new_sale.chlid.category.recycler.provider

import android.content.Context
import android.view.View
import com.example.library_common.adapter.multi.JssMultiItemViewHolder
import com.example.shushiyunsst.R
import com.example.shushiyunsst.fragment.main.home.child.new_sale.chlid.category.recycler.modler.GridContent

class GridContentProvider(view: View) : JssMultiItemViewHolder<GridContent>(view) {


//    private var mAdapter: CommAdapter<GridContent>? = null

    override fun getItemLayout()= R.layout.classify_grid_content_provider

    override fun convert(context: Context?, m: GridContent?) {
        super.convert(context, m)
            setImageNetUrl(R.id.icon, m?.catPic)
                .setText(R.id.title_template,m?.catName)
//        val mXGridLayout: XGridLayout = findView22(R.id.mXGridLayout)

//        if (mAdapter == null) {
//            mAdapter =
//                object : CommAdapter<GridContent>(
//                    context,
//                    R.layout.classify_grid_content_item_provider
//                ) {
//                    override fun convert(
//                        holder: XQuickViewHolder,
//                        item: GridContent,
//                        position: Int
//                    ) {
//                        holder.displayImage(R.id.icon, item.url)
//                            .setText(R.id.title_template,item.title)
//                    }
//                }
//            if (adapter is JssNewMultipleAdapter<*>) {
//                mXGridLayout.maxItem = m?.data?.size ?: 0
//                mXGridLayout.setAdapter(
//                    mAdapter,
//                    (adapter as JssNewMultipleAdapter<*>).lifecycle
//                )
//            }
//        }
//
//        mAdapter?.addAll(m?.data as MutableList<GridContent>)
    }

}